﻿
function ValidData() {

    var txtPageSize = document.getElementById(mstrControlProfix + "txtPageSize");
    var txtReportType = document.getElementById(mstrControlProfix + "txtReportType");
    
    var txtSMTP = document.getElementById(mstrControlProfix + "txtSMTP");
    var txtSMTPAccount = document.getElementById(mstrControlProfix + "txtSMTPAccount");
    var txtSMTPPassword = document.getElementById(mstrControlProfix + "txtSMTPPassword");
    var txtFromEmailAddress = document.getElementById(mstrControlProfix + "txtFromEmailAddress");
    
    var txtSMSURL = document.getElementById(mstrControlProfix + "txtSMSURL");
    var txtSMSAccount = document.getElementById(mstrControlProfix + "txtSMSAccount");
    var txtSMSPassword = document.getElementById(mstrControlProfix + "txtSMSPassword");

    var txtYDCustomerService = document.getElementById(mstrControlProfix + "txtYDCustomerService");
    var txtLTCustomerService = document.getElementById(mstrControlProfix + "txtLTCustomerService");
    var txtDXCustomerService = document.getElementById(mstrControlProfix + "txtDXCustomerService");

    if (txtPageSize.value == "") {
        alert("每页显示的数据条数不能为空。");
        txtPageSize.focus();
        return false;
    }
    if (txtReportType.value == "") {
        alert("允许上传的报文类型不能为空。");
        txtReportType.focus();
        return false;
    }
    
    //邮件基本设置的验证
    if (txtSMTP.value == "") {
        alert("服务器地址不能为空。");
        txtSMTP.focus();
        return false;
    }
    if (txtSMTPAccount.value == "") {
        alert("邮箱账号不能为空。");
        txtSMTPAccount.focus();
        return false;
    }
    if (txtSMTPPassword.value == "") {
        alert("邮箱密码不能为空。");
        txtSMTPPassword.focus();
        return false;
    }
    if (txtFromEmailAddress.value == "") {
        alert("显示的邮箱名不能为空。");
        txtFromEmailAddress.focus();
        return false;
    }
    if (!(/[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/.test(txtFromEmailAddress.value)) && txtFromEmailAddress.value != "") {
        alert("请输入正确的邮箱格式。例如：<XXXX@XXX.XXX>。");
        txtSMTPAccount.focus();
        return false;
    }

    //短信基本设置的验证
    if (txtSMSURL.value == "") {
        alert("短信URL不能为空。");
        txtSMSURL.focus();
        return false;
    }
    if (txtSMSAccount.value == "") {
        alert("短信帐号不能为空。");
        txtSMSAccount.focus();
        return false;
    }
    if (txtSMSPassword.value == "") {
        alert("短信密码不能为空。");
        txtSMSPassword.focus();
        return false;
    }

    if (txtYDCustomerService.value == "") {
        alert("移动客服号不能为空。");
        txtYDCustomerService.focus();
        return false;
    }
    if (txtLTCustomerService.value == "") {
        alert("联通客服号不能为空。");
        txtLTCustomerService.focus();
        return false;
    }
    if (txtDXCustomerService.value == "") {
        alert("电信客服号不能为空。");
        txtDXCustomerService.focus();
        return false;
    }
    return true;
}
